include globus-makefile-header.mk

# use mkoctfile script
CC=mkoctfile

# path to local library
LOCAL_LDFLAGS = -L.// -L/usr/local/globus-4.0.4/lib
#LOCAL_LDFLAGS = -L.// -L/usr/local/globus/lib
LOCAL_CPPFLAGS = -I/home/gtonic/workspace/octave_xml  -I/usr/local/globus-4.0.4/include/gcc32dbg
#LOCAL_CPPFLAGS = -I/home/fhv-users/tge1468/octave_xmltoolbox  -I/usr/local/globus/include/gcc32dbg

FTP_LINKS = gt_sizeof gt_exists gt_delete gt_mkdir gt_rmdir gt_transfer 

GASS_LINKS = gt_startgass gt_stopgass

GRAM_LINKS = gt_jobstatus gt_jobkill

LIB = libglobuscpp

PROGRAMS = gt_gridftp gt_load gt_save gt_certinfo gt_createproxy gt_destroyproxy gt_jobsubmit gt_proxyinfo gt_gass_server gt_help gt_jobping 

#gt_jobping

all: $(LIB) $(PROGRAMS) $(FTP_LINKS) $(GASS_LINKS) $(GRAM_LINKS)

$(FTP_LINKS):
	ln -s gt_gridftp.oct $@.oct

$(GASS_LINKS):
	ln -s gt_gass_server.oct $@.oct

$(GRAM_LINKS):
	ln -s gt_jobsubmit.oct $@.oct

$(LIB):
	$(GLOBUS_CXX) -shared -o $@.so $(GLOBUS_CPPFLAGS) $(LOCAL_CPPFLAGS) $(LOCAL_LDFLAGS) $(GLOBUS_LDFLAGS) \
	myproxy_sources/myproxy.c myproxy_sources/gsi_socket.c \
	myproxy_sources/verror.c myproxy_sources/string_funcs.c \
	myproxy_sources/myproxy_authorization.c myproxy_sources/myproxy_creds.c \
	myproxy_sources/myproxy_log.c myproxy_sources/ssl_utils.c \
	myproxy_sources/certauth_resolveuser.c myproxy_sources/myproxy_ocsp.c \
	myproxy_sources/myproxy_popen.c myproxy_sources/myproxy_delegation.c \
	myproxy_sources/myproxy_read_pass.c \
	globuscpp/CredManager.cc globuscpp/Callback.cc globuscpp/GramJobCallback.cc \
	globuscpp/URL.cc globuscpp/XIOClient.cc globuscpp/GridFTPClient.cc \
	globuscpp/GassServer.cc $(GLOBUS_PKG_LIBS)


$(PROGRAMS): 
	$(CC) -v -o $@.oct $(GLOBUS_CPPFLAGS) $(LOCAL_CPPFLAGS) $(GLOBUS_LDFLAGS) $(LOCAL_LDFLAGS) gt-ls.cc $@.cc $(GLOBUS_PKG_LIBS) -lglobuscpp -lxerces-c -loctavexml

clean:
	rm -f $(PROGRAMS) *.a *.o *.oct octave-core libglobuscpp.so
	rm -r latex html

tests:
	octave -q --funcall test/runtests

doxygen:
	doxygen doxygen.conf
